#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
int arr[N];
int n, c, d;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n >> c >> d;
		memset(arr, 0, sizeof(arr));
		LL sum = 0;
		for (int i = 1; i <= n; i++) {
			cin >> arr[i];
			sum += arr[i];	
		}
		/*if ((1 + n) * n == 2 * sum) {
			cout << 0 << endl;
			continue;
		}*/
		sort(arr + 1, arr + n + 1);
		int m = 0;
		//1 3 3 3 5 7 
		for (int i = 1; i <= n; i++) {
			if (i == 1 || arr[i - 1] != arr[i]) {
				arr[++m] = arr[i];
			}
		}
		LL ans1 = 1ll * c * (n - m);
		LL mi = 1e18;
		for (int i = 1; i <= m; i++) {
			mi = min(mi, 1ll * (arr[i] - i) * d + 1ll * (m - i) * c);
		}
		mi = min(mi, 1ll * m * c + d);
		cout << mi + ans1 << endl;
	}
	return 0;
}
